#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int temperatureTrend(vector<int>& temperatureA, vector<int>& temperatureB)
    {
        int n = temperatureA.size();
        vector<int> ans(n - 1);
        for (int i = 0; i < n - 1; i++)
        {
            if ((temperatureA[i] > temperatureA[i + 1] && temperatureB[i] > temperatureB[i + 1]) || (temperatureA[i] == temperatureA[i + 1] && temperatureB[i] == temperatureB[i + 1]) || (temperatureA[i] < temperatureA[i + 1] && temperatureB[i] < temperatureB[i + 1]))
                ans[i] = 1;
            else ans[i] = 0;
        }
        int count = 0;
        int max = 0;
        for (int i = 0; i < n - 1; i++)
        {
            if (ans[i] == 0)
            {
                max = count > max ? count : max;
                count = 0;
                continue;
            }
            count++;
        }
        max = count > max ? count : max;
        return max;
    }
};